using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Roslyn.Compilers.CSharp;
using Roslyn.Services;

namespace ContentOverContainer.Common
{
    /// <summary>
    /// List of node pairs.
    /// </summary>
    /// <author>Harald Binkle</author>
    public class ChangeNodeInfoList : List<ChangeNodeInfo>
    {
        public void Add(SyntaxNode pOrg, SyntaxNode pNew, IDocument pDoc)
        {
            this.Add(new ChangeNodeInfo(pOrg, pNew, pDoc));
        }
    }

    /// <summary>
    /// Node pair. Node with Multiplicity syntax and that node transformed to syntax without multiplicity
    /// </summary>
    /// <author>Harald Binkle</author>
    public class ChangeNodeInfo
    {
        public SyntaxNode OrgSyntaxNode { get; set; }   

        public List<ChangeNodeMethodSubstitution> MethodSubstitutionList { get; set; }

        public SyntaxNode NewSyntaxNode { get; set; }

        public IDocument Document { get; set; }

        public ChangeNodeInfo(SyntaxNode pOrg, SyntaxNode pNew, IDocument pDoc) :this(pNew)
        {
            OrgSyntaxNode = pOrg;
            Document = pDoc;
        }

        public ChangeNodeInfo(SyntaxNode pNew)
        {
            NewSyntaxNode = pNew;
            MethodSubstitutionList = new List<ChangeNodeMethodSubstitution>();
        }

        public override string ToString()
        {
            return OrgSyntaxNode.ToString()+"  ==>>  "+NewSyntaxNode.ToString();
        }
    }

    public class ChangeNodeMethodSubstitution
    {
        public ClassDeclarationSyntax Class { get; set; }
        public MethodDeclarationSyntax MethodDeclaration { get; set; }
    }
}
